package com.ikkong.system.util;

import com.ikkong.core.dao.Db;
import com.ikkong.core.toolbox.Record;
import com.ikkong.core.toolbox.kit.BeanKit;

import java.util.ArrayList;
import java.util.List;

/**
 * 构建树形菜单
 * UserTreeUtils
 * @author lishang
 * 2018年8月30日
 */
public class TreeUtil {
	/**
	 * 针对二级菜单
	 * treeUserTreeList:( ). <br/> 
	 * @author lishang
	 * @param sourceList
	 * @return
	 */

	public static List<Record> treeRoot(List<Record> sourceList){


		return sourceList;
	}




	public static void main(String[] args) {
		List<Record> sourceList=new ArrayList<>();
		List<Record> records = Db.init().selectList("select * from mall_cart where p_id = " + 1);
		Record mallCart = Db.init().selectOne("select * from mall_cart where id = " + 1);
//            MallCart  mallCarts = TreeUtil.treeRoot(records,mallCart);
//		MallCart childrens = treeRoot(records, mallCart);
//		System.out.println(JSONObject.toJSON(childrens));

//		MallCart userTree=new MallCart();
//		userTree.setP_id(0);
//		userTree.setId(1);
//		userTree.setName("菜单一级");
//		sourceList.add(Record.parse(userTree));
//
//		MallCart UserTree2=new MallCart();
//		UserTree2.setP_id(1);
//		UserTree2.setId(2);
//		UserTree2.setName("菜单二级1");
//		sourceList.add(Record.parse(UserTree2));
//
//		MallCart UserTree3=new MallCart();
//		UserTree3.setP_id(2);
//		UserTree3.setId(3);
//		UserTree3.setName("菜单三级");
//		sourceList.add(Record.parse(UserTree3));
//
//		MallCart UserTree4=new MallCart();
//		UserTree4.setP_id(3);
//		UserTree4.setId(4);
//		UserTree4.setName("菜单四级");
//		sourceList.add(Record.parse(UserTree4));
//
//		MallCart UserTree5=new MallCart();
//		UserTree5.setP_id(1);
//		UserTree5.setId(6);
//		UserTree5.setName("菜单二级2");
//		sourceList.add(Record.parse(UserTree5));
//
//		MallCart childrens = treeRoot(sourceList, userTree);
//		System.out.println(JSONObject.toJSON(childrens));
	}

}